<template>
    <div class="header">
        <div class="header-box common">
            <div :class="['header-box-left', $route.path == '/home' ? 'dark' : '']">欢饮来到叩丁严选</div>
            <div class="header-box-right">
                <ul>
                    <li><img src="../assets/logo.png" alt="" class="user-img">用户名:--</li>
                    <li>
                        <router-link to="/">我的鸡腿:{{ chicken }}</router-link>
                    </li>
                    <li>
                        <router-link to="/">获取鸡腿</router-link>
                    </li>
                    <li><a href="https://www.wolfcode.cn/new/portal/index.html">叩丁狼官网</a></li>
                    <li>
                        <div class="login" v-if="!$store.state.denglu" @click="mes">
                            <span class="user_login">登录</span>

                        </div>
                        <div class="login" v-else @click="isLogin">

                            <i class="bi bi-cart3" style="font-size: 17px;padding-right: 2px;"></i>
                            购物车
                            <span class="circle">{{ count }}</span>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
        <transition name="zoom">

            <Login v-if="$store.state.isLoginModel" class="login" :key="1"></Login>
        </transition>
    </div>
</template>

<script>
import Login from '@/components/Login'

export default {
    props: {
        login: {
            type: Boolean,
            default: false
        },
        chicken: {
            type: Number,
            default: 0,
        },
        count: {
            type: Number,
            default: 0,
        },
        isShow: {
            type: Boolean,
            default: false
        }
    },
    methods: {
        isLogin() {
            location.href = '/index'

        },
        mes() {
            this.$store.commit('changeLogin', true)
        }
    },
    comments: {
        Login
    },
    components: { Login }
}
</script>

<style lang="less" scoped>
@media screen and (max-width: 630px) {
    .header {
        font-size: 7px !important;


        .header-box-left {
            display: none;

        }

        .header-box-right {

            li:last-child .login {

                display: inline-block !important;

                .circle {
                    display: none !important;

                }
            }
        }

    }
}

// @import url("@/assets/css/common.css");

.dark {
    color: #78859f;


}

/** 动画进行时的class **/
.zoom-enter-active,
.zoom-leave-active {
    transition: all .3s;
}

/** 设置进场开始的状态和离场结束的状态，都是缩放到0 **/
.zoom-enter,
.zoom-leave-to {
    opacity: 0;
}

/** 设置进场结束的状态和离场开始的状态, 都是缩放到1 **/
.zoom-enter-to,
.zoom-leave {
    opacity: 1;
}

.header {
    height: 40px;
    background-color: #242b39;
    font-size: 14px;
    color: #fff;
    line-height: 40px;

    .header-box {
        flex: 1;
        display: flex;
        justify-content: space-between;

        .header-box-right {
            ul {
                display: flex;
                align-items: center;

                .user-img {
                    width: 1.5em;
                    height: 1.5em;
                    vertical-align: middle;
                    background-color: red;
                    border-radius: 50%;
                    margin-right: 5px;
                }

                li {
                    padding: 0 15px;
                    text-align: center;

                    a {
                        color: #fff;
                        text-decoration: none;
                    }

                    &:last-child div {
                        display: flex;
                        align-items: center;
                        cursor: pointer;


                    }

                    &:last-child {
                        background-color: #0a328e;
                        height: 40px;


                        .circle {
                            width: 22px;
                            height: 22px;
                            border-radius: 11px;
                            background-color: #fd604d;
                            display: flex;
                            align-items: center;
                            justify-content: space-around;
                            margin-left: 4px;

                        }

                        .user_login {
                            width: 100px;
                        }
                    }


                }
            }


        }
    }
}
</style>